import { ajax } from '../lib/ajax.js';
console.log(ajax);

// #region echo请求演示
let txtEcho = document.getElementById('txtEcho');
let btnEcho = document.getElementById('btnEcho');
let divEcho = document.getElementById('divEcho');

  btnEcho.addEventListener('click', () => {
    ajax.get('/test/echo', { echo: txtEcho.value }, (data) => {
    divEcho.innerHTML = JSON.stringify(data);
    });
});


// #endregion

// #region json请求演示
let btnJson = document.getElementById('btnJson');
let divtJson = document.getElementById('divJson');

btnJson.addEventListener('click', () => {
  ajax.post('/test/converter/json', 
    { 
      lid: 11,
      logType:'用户登录',
      logInfo:'用户登录成功' ,
      lastupdate:'2019-09-01',
    },
    (data) => {
      divtJson.innerHTML = JSON.stringify(data);
    }
    );
});



// #endregion
